import { defineStore } from 'pinia'

export const useAppStore = defineStore('app', {
  state: () => ({
    isMobile: false,
    currentLanguage: 'zh',
    isMenuOpen: false
  }),
  getters: {
    getIsMobile: (state) => state.isMobile,
    getCurrentLanguage: (state) => state.currentLanguage,
    getIsMenuOpen: (state) => state.isMenuOpen
  },
  actions: {
    setIsMobile(value: boolean) {
      this.isMobile = value
    },
    setCurrentLanguage(language: 'zh' | 'en') {
      this.currentLanguage = language
    },
    toggleMenu() {
      this.isMenuOpen = !this.isMenuOpen
    },
    closeMenu() {
      this.isMenuOpen = false
    }
  }
})